import type {PageParam, PageResult} from '@vben/request';
import type {Dayjs} from 'dayjs';

import {requestClient} from '#/api/request';
export namespace PerWorkExperienceApi {
  /** 工作简历信息 */
  export interface WorkExperience {
    id: number; // 主键ID
    employeeId?: number; // 人员ID，对应 per_employee.id
    workUnit: string; // 工作单位
    startDate: string | Dayjs; // 开始时间
    endDate: string | Dayjs; // 结束时间
    workDescription: string; // 工作描述
    status: number; // 是否有效（1：有效，0：无效）
    remarks: string; // 备注
  }
}

/** 查询工作简历分页 */
export function getWorkExperiencePage(data: PageParam,desensitize: boolean,encrypt: boolean) {
  return requestClient.post<PageResult<PerWorkExperienceApi.WorkExperience>>('/per/work-experience/page', data,{ desensitize,encrypt });
}

/** 查询工作简历详情 */
export function getWorkExperience(id: number) {
  return requestClient.get<PerWorkExperienceApi.WorkExperience>(`/per/work-experience/get?id=${id}`);
}

/** 新增工作简历 */
export function createWorkExperience(data: PerWorkExperienceApi.WorkExperience) {
  return requestClient.post('/per/work-experience/create', data);
}

/** 修改工作简历 */
export function updateWorkExperience(data: PerWorkExperienceApi.WorkExperience) {
  return requestClient.put('/per/work-experience/update', data);
}

/** 删除工作简历 */
export function deleteWorkExperience(id: number) {
  return requestClient.delete(`/per/work-experience/delete?id=${id}`);
}

/** 批量删除工作简历 */
export function deleteWorkExperienceList(ids: number[]) {
  return requestClient.delete(`/per/work-experience/delete-list?ids=${ids.join(',')}`)
}

/** 导出工作简历 */
export function exportWorkExperience(params: any) {
  return requestClient.download('/per/work-experience/export-excel', { params });
}
